﻿(function ($) {
    $.fn.addpage = function (option) {
        option = $.extend({
            submitSlt: ".submit"
        }, option);
        return this.each(function () {
            var view = $(this);
            var settings = $.extend({}, option);
            var successmsg = view.attr("successmsg") || "操作成功";
            view.find(settings.submitSlt).click(function () {
                var data = view.serialize();
                var op = {
                    url: view.attr("action"),
                    data: data,
                    type: "json",
                    backtype: "alert",
                    successmsg: successmsg,
                    aftersuccess: function () {
                        var helper = view.PanelParent().CloseContainer();
                    }
                };
                App.getAjaxManager().ajaxpost(op);
            });

        });
    };

})(jQuery);